package com.bupt.server.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@TableName("service_record")
@AllArgsConstructor
@NoArgsConstructor
public class Service_Record {
    @TableField(value = "record_id")
    private int record_id;

    @TableField(value = "room_id")
    private int room_id;

    @TableField(value = "start_time")
    private String start_time;

    @TableField(value = "end_time")
    private String end_time;

    @TableField(value = "current_temperature")
    private float current_temperature;

    @TableField(value = "target_temperature")
    private float target_temperature;

    @TableField(value = "speed")
    private String speed;

    @TableField(value = "ac_status")
    private String ac_status;

    @TableField(value = "status")
    private boolean status;

    @TableField(value = "total_air_cost")
    private float total_air_cost;

    @TableField(value = "total_cost")
    private float total_cost;

    //添加调度次数：从服务队列到等待队列的次数
    public Service_Record CalServiceRecord(Service_Record serviceRecord,Room room,String last_speed){
        serviceRecord.setTotal_air_cost(room.getTotal_air_cost());
        serviceRecord.setSpeed(last_speed);
        serviceRecord.setStatus(true);
        serviceRecord.setAc_status(room.getAc_status());
        serviceRecord.setStart_time("dateTime.toString()");
        serviceRecord.setTarget_temperature(room.getTarget_temperature());
        serviceRecord.setCurrent_temperature(room.getCurrent_temperature());
        serviceRecord.setEnd_time("LocalDateTime.now().toString()");
        serviceRecord.setTotal_cost(room.getTotal_air_cost()+100);
        return serviceRecord;
    }

}
